Learn R Programming

spacesRGB (version 1.5-0)

RGB Space Query: Query RGB Spaces

Description

Query and summarize the installed RGB spaces. The RGB spaces are stored in a dictionary, which comes with 8 RGB spaces pre-installed. These spaces are: sRGB, AdobeRGB, ProPhotoRGB, AppleRGB, BT.709, BT.2020, 240M, and HD+2.4.

Usage

summaryRGB( verbosity=1 )

getRGB( space ) getWhiteXYZ( space, which='scene' )

Value

summaryRGB(), with the default verbosity=1, returns a data.frame

with a row for each RGB space. The row contains primary, whitepoint, and transfer function information for each space. The primary/whitepoint data is for both scene and display; all the data is numerical and the columns are labeled. There are 22 columns so the display is very wide.

The transfer function data is a very short string. If the OETF is classical (pure 1/\(\gamma\) power law), the string is 1/\(\gamma\). If the OETF is not classical, the string is 1/~\(\gamma\), where \(\gamma\) is the best-fit (or approximate or effective) \(\gamma\) to the OETF in the \(L^1\)-norm.

Similarly, if the EOTF is classical (pure \(\gamma\) power law) the string is \(\gamma\), and if the EOTF is not classical the string is ~\(\gamma\).

The OOTF is the quotient (to 2 decimal places) of the gammas of EOTF and OETF (either true gamma or best-fit gamma). If either gamma is best-fit then the string is preceede by a '~', which means effective.

If the TransferFunction has dimension 1, but the domain and range are not the interval [0,1], the string is '1D'. If the TransferFunction has dimension 3, the string is '3D'.

If verbosity=0, summaryRGB() returns the names of all the RGB spaces.

getRGB() returns a list with these items:

spacethe full and original name of the RGB space
scenea list with items primaries, whiteXYZ, RGB2XYZ, and XYZ2RGB
displaya list with items primaries, whiteXYZ, RGB2XYZ, and XYZ2RGB
EOTFElectro-Optical Transfer Function
OETFOpto-Electronic Transfer Function
OOTFOpto-Optical Transfer Function, and numerically equal to OETF*EOTF

The items in the lists scene and display are

primaries4x2 matrix with the xy chromaticities of the RGB primaries and white
whiteXYZXYZ of the display white point, which maps to RGB=(1,1,1)
RGB2XYZ3x3 matrix taking RGB to XYZ
XYZ2RGB3x3 matrix taking XYZ to RGB

All transfer functions are actual TransferFunctions objects, and not the numerical exponent or character string name. They are suitable for plotting with plot.TransferFunction(); see the Examples. In case of error, getRGB() returns NULL.

getWhiteXYZ()

returns a numeric 3-vector with the XYZ of the whitepoint of the scene or the display. In case of error it returns NULL.

Arguments

space

name of the RGB space to query. The name matching is partial and case-insensitive.

verbosity

an integer that controls the return value of summaryRGB(), see Value.

which

the source of the whitepoint, either 'scene' or 'display'. Matching is partial and case-insensitive.

Details

The function getWhiteXYZ() is provided because some applications only need the whitepoint for chromatic adaptation purposes, and this function is faster than getRGB().

References

Lindbloom, Bruce. RGB/XYZ Matrices. http://brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html

See Also

installRGB(), plot.TransferFunction()

Examples

Run this code
# make plot comparing three EOTFs
plot( getRGB('sRGB')$EOTF, col='black' )
plot( getRGB('BT.709')$EOTF, col='blue', add=TRUE )
plot( getRGB('ProPhotoRGB')$EOTF, col='red', add=TRUE )

Run the code above in your browser using DataLab